const path = require("path");

class Assets {
  static _primary = null;

  constructor() {
    this.entry = "";
    this.entries = {};
  }

  static get primary() {
    return Assets._primary || (Assets._primary = new Assets());
  }

  js(entry, output) {
    if (!~output.indexOf(".js")) {
      output = output + path.basename(entry, ".js");
    }
    this.entry = output;
    this.entries[this.entry] = [].concat(path.resolve(entry));
    return this;
  }

  less(src, output) {
    this.entries[this.entry].push(path.resolve(src));
    return this;
  }
}

module.exports = Assets.primary;
